import React, { Suspense } from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import store from './store/index';
import './icon/my/font/iconfont.css';
ReactDOM.render(
    <BrowserRouter>
        <Provider store={store}>
            {/* 使用了路由懒加载，所以需要使用<Suspense>包起来 */}
            <Suspense fallback={<div></div>}>
                <Switch>
                    <Route path="/" render={routerProps => {
                        return <App {...routerProps} />
                    }} />
                </Switch>
            </Suspense>
        </Provider>
    </BrowserRouter>,
    document.getElementById('root')
)

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA

// serviceWorker.unregister();
